namespace SinaFinanceBaseClassLibrary
{
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.IO;
    using System.IO.IsolatedStorage;

    public class IsolatedStorageClass
    {
        public static void CreateIsolatedStorageDirectory(List<string> DirectoryPaths)
        {
            using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication())
            {
                string str = SetIsolateStorageDirectoryPath(DirectoryPaths);
                file.CreateDirectory(str);
            }
        }

        public static void CreateIsolatedStorageFileInDirectory(string FileName)
        {
            using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication())
            {
                file.CreateFile(FileName).Close();
            }
        }

        public static void CreateIsolatedStorageFileInDirectory(string DirectoryPath, string FileName)
        {
            using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication())
            {
                if (string.IsNullOrEmpty(DirectoryPath))
                {
                    file.CreateFile(FileName).Close();
                }
                else
                {
                    file.CreateFile(Path.Combine(DirectoryPath, FileName)).Close();
                }
            }
        }

        public static string SetIsolateStorageDirectoryPath(List<string> DirectoryPaths)
        {
            IEnumerator enumerator = (IEnumerator) DirectoryPaths.GetEnumerator();
            string str = string.Empty;
            for (int i = 0; enumerator.MoveNext(); i++)
            {
                if (i.Equals(0))
                {
                    str = enumerator.Current.ToString();
                }
                else
                {
                    str = Path.Combine(str, enumerator.Current.ToString());
                }
            }
            return str;
        }
    }
}
